home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / netzwerk / pc2am / configpc2amiga next >
Text File  |  1994-03-14  |  11KB  |  325 lines

  1. ; Configuration script for the PC2Am program
  2.  
  3. ;Indicator types
  4. (set ISTR0 "None")
  5. (set ISTR1 "LED")
  6. (set ISTR2 "Gopher-like")
  7. (set ISTR3 "Background")
  8. ;(set ISTR4 "Mouse")
  9.  
  10. ;Speeds
  11. (set SPEED0 "1200")
  12. (set SPEED1 "2400")
  13. (set SPEED2 "4800")
  14. (set SPEED3 "9600")
  15. (set SPEED4 "19200")
  16. (set SPEED5 "38400")
  17. (set SPEED6 "57600")
  18. (set SPEED7 "115200")
  19.  
  20. ;Cables
  21. (set CABLE0 "LapLink 4W")
  22. (set CABLE1 "Special 4W")
  23. (set CABLE2 "Special 8W")
  24.  
  25.  
  26. (procedure EditConfig
  27.  
  28.   ; Set device
  29.   (set DevOK 0)
  30.   (until (= DevOK 1)
  31.  
  32.     (set DefDev ("DEVS:/%s" Device))
  33.     (set Device
  34.       (fileonly
  35.         (askfile
  36.           (prompt "Select device you want to use. For parallel transfer "
  37.                   "select PC2AmPar.device. Click on HELP for further details")
  38.           (help 
  39.             "You have to select device to communicate via. It will mostly be \"serial.device\" "
  40.             "but you can also use \"artser.device\" etc. But remember that some devices don't "
  41.             "support the Break() function (baudbandit.device), so they cannot be "
  42.             "used.\n\nFor parallel transfer is used device called PC2AmParallel.device."
  43.           )
  44.           (default DefDev)
  45.         )
  46.       )
  47.     )
  48.  
  49.     (set DevOK 1)
  50.     (if (= Device "parallel.device")
  51.       (
  52.         (message
  53.           "PC2Amiga does not use standart parallel.device for the transfer. "
  54.           "For parallel transfers it uses its own device called 'PC2AmParallel.device'. "
  55.           "If you wanted to set parallel transfer use this one. Now you will have to select "
  56.           "the device again."
  57.         )
  58.         (set DevOK 0)
  59.       )
  60.     )
  61.   )
  62.  
  63.   (if (= Device "PC2AmParallel.device")
  64.     (
  65.       (set Unit
  66.         (askchoice
  67.           (prompt "Which cable do you use")
  68.           (choices CABLE0 CABLE1 CABLE2)
  69.           (default Unit)
  70.           (help
  71.            "Set up a cable you use. For more info about cable types, see guide, section HowToRunProgram/Cables.\n\n"
  72.           )
  73.         )
  74.       )
  75.  
  76. ;      (set Flags
  77. ;        (askbool
  78. ;          (prompt "You have to select which method to use for parallel transfer. "
  79. ;                  "If you check this checkbox, a faster method will be used. However, "
  80. ;                  "this method has some 'hazards' due to slow CIA. If you don't check it, "
  81. ;                  "program will use safe but slow method. Fast method  "
  82. ;                  ""
  83. ;          )
  84. ;        )
  85. ;      )
  86.     )
  87.  
  88.  
  89.     (
  90.       ; Set unit
  91.       (set Unit
  92.         (asknumber
  93.           (prompt "Select unit of the device")
  94.           (help "This will be mostly zero. You will have to change it only if you use a multiserial card.")
  95.           (default Unit)
  96.        )
  97.       )
  98.  
  99.       ; Set Flags
  100.       (set Flags
  101.         (asknumber
  102.           (prompt "Select open flags of the device")
  103.           (help "This will be mostly zero. You will have to change it only if you use a multiserial card.")
  104.          (range -2147483648 2147483647)
  105.            (default Flags)
  106.         )
  107.       )
  108.  
  109.       ; Set baud rate
  110.       ; Find baud code
  111.       (set BaudCode 0)
  112.       (while (AND (> BaudRate (+ 0 (select BaudCode SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7))) (< BaudCode 7))
  113.         (set BaudCode (+ BaudCode 1))
  114.       )
  115.       (set BaudRate
  116.         (+ 0
  117.           (select 
  118.             (askchoice 
  119.               (prompt "Select baud rate")
  120.               (choices SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7)
  121.               (default BaudCode)
  122.               (help 
  123.               "You have to select baud rate to communicate on. It is important to set "
  124.               "this baudrate to the same value on both Amiga and PC. Selecting too big "
  125.               "baudrate may cause infunctionality, low baudrates lowers transfer speed. "
  126.               "If you have at least A500 and 386SX/40, you can choose 57600."
  127.               )
  128.             )
  129.             SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7
  130.           )
  131.         )
  132.       )
  133.  
  134.       ;Set timeout
  135.       (set Timeout
  136.         (asknumber
  137.           (prompt "Set timeout\nNote, that it is in TENTHS of second.")
  138.           (help
  139.             "Timeout is the time, after which Amiga will try to restore "
  140.             "send PC a break, to make it reply packet etc. Good value is about"
  141.             "20 (2 secs) or a little bit more. High values do not have sense, "
  142.             "because there will be spent much time in waiting for PC. But setting "
  143.             "it too small may cause many timeouts when working with slower device "
  144.             "(floppy) or on small baud rates.\n\n"
  145.             "When you use parallel transfer, you should set this value to 100 or similar value."
  146.           )
  147.           (default Timeout)
  148.         )
  149.       )
  150.     )
  151.   )
  152.  
  153.   ;Set MaxTransfer
  154.   (set MaxTransfer
  155.     (asknumber
  156.       (prompt "Set maximal length of a packet.")
  157.       (range 128 8192)
  158.       (help
  159.         "Here you can set the maximal length of packet, that is transfered via "
  160.         "serial (parallel) line. Note that it is used only for sending files, "
  161.         "because other packets (open, ...) are only about 20 bytes long. So set "
  162.         "it to a lower value only when you can list directories well (listing main "
  163.         "PC: directory takes shorter packets that listing "true" directory on PC). "
  164.         "Usually, you can keep this value at least 4096 or even 8192."
  165.       )
  166.       (default MaxTransfer)
  167.     )
  168.   )
  169.  
  170.  
  171.   ;Set progress indicator
  172.   (set IndicType
  173.     (askchoice 
  174.       (prompt "Select progress indicator type")
  175.       (choices ISTR0 ISTR1 ISTR2 ISTR3)
  176.       (default IndicType)
  177.       (help 
  178.         "Progress indicator is something that tells you the communication is "
  179.         "still working (data are transfering). Here's a description of supported "
  180.         "types:\n\n"
  181.         "NONE - No indicator will be used\n\n"        
  182.         "LED - Power LED brightness will be turned after sending each packet. "
  183.         "So when communication works, you will see LED flashing. But it may confuse "
  184.         "you, because it looks like you have been visited by a guru (system crash)."
  185.         "It may also interfere with a music playing program, because turning LED "
  186.         "turns also ON/OFF audio filter.\n\n"
  187.         "GOPHER-LIKE - In the PC2Amiga commodity window, there's a square, in which "
  188.         "you will see rotating line. But you have to popup PC2Amiga to see it, so you "
  189.         "cannot look at it all the time.\n\n"
  190.         "BACKGROUND - After sending every packet, background flashes. Maybe good for "
  191.         "some people, but for me it is too \"hard\" indication.\n\n"
  192. ;        "MOUSE - Mouse will flash as when unpacking by PowerPacker."
  193.       )
  194.     )
  195.   )
  196.  
  197.   ; Hotkey qualifier
  198.   (set HotKeyQ
  199.     (askoptions
  200.       (prompt "Choose qualifiers for commodity hotkey. If you don't select any, hotkey will be disabled.")
  201.       (choices "CTRL" "LALT" "RALT" "LSHIFT" "RSHIFT" "LCOMMAND" "RCOMMAND")
  202.       (default HotKeyQ)
  203.       (help 
  204.         "PC2Amiga window can be now popped up by a hotkey. "
  205.         "Here you select hotkey 'shifting'. In the next requester "
  206.         "you will select the key itself."
  207.       )
  208.     )
  209.   )
  210.  
  211.   (set HotKeyC
  212.     (askstring
  213.       (prompt "Enter KEY for the hotkey (shifting has been selected "
  214.               "before.) Only first char is considered."
  215.       )
  216.       (default HotKeyC)
  217.       (help "This is the hotkey that the PC2Amiga window will open on.")
  218.     )
  219.   )
  220. )
  221.  
  222. (if (<= (getversion (resident)) (* 37 65536))
  223.   (abort "Sorry, this script works only for systems 2.1 and later (kickstart version 37+)")
  224. )
  225.  
  226. (if (= (exists "c:GetPCSpecs") 0)
  227.   (abort "Cannot find command 'c:GetPCSpecs'. If you haven't installed PC2Amiga yet, you must do it before running this configuration script.")
  228. )
  229.  
  230. (if (= (exists "c:SetPCSpecs") 0)
  231.   (abort "Cannot find command 'c:SetPCSpecs'. If you haven't installed PC2Amiga yet, you must do it before running this configuration script.")
  232. )
  233.  
  234. (user 2)
  235.  
  236. (set FileName 
  237.   (askfile
  238.     (prompt "Please enter where you have installed the device specification file (\"PC\").")
  239.     (help
  240.       "There's a device specification file (called \"PC\"), which also contains "
  241.       "configuration data. Configuration script needs to know where it is to change "
  242.       "it. It should be either in the SYS:Storage/DOSDrivers or DEVS:DOSDrivers directory."
  243.     )
  244.     (default "SYS:Storage/DOSDrivers/PC")
  245.   )
  246. )
  247.  
  248. (if (= (exists FileName) 0)
  249.   (abort "The file you have entered does not exist !")
  250. )
  251.  
  252. (run ("GetPCSpecs %s" FileName))
  253.  
  254. ; Get original values
  255. (set Device (getenv "P2A_DEVICE"))
  256. (set Unit (+ 0 (getenv "P2A_UNIT")))
  257. (set Flags (+ 0 (getenv "P2A_FLAGS")))
  258. (set BaudRate (+ 0 (getenv "P2A_BAUD")))
  259. (set MaxTransfer (+ 0 (getenv "P2A_MAXTRANSFER")))
  260. (set Timeout (+ 0 (getenv "P2A_TIMEOUT")))
  261. (set HFlags (+ 0 (getenv "P2A_BLOCKSPERTRACK")))
  262. (set LowCyl (+ 0 (getenv "P2A_LOWCYL")))
  263. (set IndicType (BITAND HFlags 7))
  264. (set HotKeyQ (/ (BITAND LowCyl $F00) $100))
  265. (set HotKeyC (getenv "P2A_HOTKEY"))
  266.  
  267. (until
  268.   (= Result 1)
  269.   (EditConfig)
  270.   ; Set some vars
  271.   (set TSecs (/ Timeout 10))
  272.   (set TTent (- Timeout (* TSecs 10)))
  273.   (set Result 
  274.     (if (= Device "PC2AmParallel.device")
  275.       (
  276.         (askbool
  277.           (prompt
  278.             "Confirm settings:\n\n"
  279.             ("Device: %s\nCable: %s\n" Device (select Unit CABLE0 CABLE1 CABLE2))
  280.             ("Indicator: %s\n" (select IndicType ISTR0 ISTR1 ISTR2 ISTR3))
  281.           )
  282.           (help "Script asks you to confirm your selection.")
  283.         )
  284.       )
  285.       (
  286.         (askbool
  287.           (prompt
  288.             "Confirm settings:\n\n"
  289.             ("Device: %s\nUnit: %ld\nFlags: %ld\nBaudRate: %ld\nTimeout: %ld.%lds\n" Device Unit Flags BaudRate TSecs TTent)
  290.             ("Indicator: %s\n" (select IndicType ISTR0 ISTR1 ISTR2 ISTR3))
  291.           )
  292.           (help "Script asks you to confirm your selection.")
  293.         )
  294.       )
  295.     )
  296.   )
  297. )
  298.  
  299.  
  300. ; Copy values to env vars
  301. (set HFlags IndicType)
  302. (set LowCyl (* HotKeyQ $100))
  303. (textfile (dest "ENV:P2A_DEVICE") (append Device))
  304. (textfile (dest "ENV:P2A_UNIT") (append Unit))
  305. (textfile (dest "ENV:P2A_FLAGS") (append Flags))
  306. (textfile (dest "ENV:P2A_BAUD") (append BaudRate))
  307. (textfile (dest "ENV:P2A_MAXTRANSFER") (append MaxTransfer))
  308. (textfile (dest "ENV:P2A_TIMEOUT") (append Timeout))
  309. (textfile (dest "ENV:P2A_BLOCKSPERTRACK") (append HFlags))
  310. (textfile (dest "ENV:P2A_LOWCYL") (append LowCyl))
  311. (textfile (dest "ENV:P2A_HOTKEY") (append HotKeyC))
  312.  
  313. (run ("SetPCSpecs %s T:PC" FileName))
  314.  
  315. (copyfiles
  316.   (source "t:PC")
  317.   (dest (pathonly FileName))
  318. )
  319.  
  320.  
  321. (exit "\n\nDON'T FORGET TO SETUP ALSO THE PC PART\n(USING THE \"PC2AMCFG.EXE\" PROGRAM)")
  322.  
  323. (welcome)
  324.  
  325.